<template>
	<view>
		<nav-bar class="header" :title="title" @goBack="goBack">
		</nav-bar>
		<view class="bussiness-detail">
			<!-- 业务详情 -->
			<van-form v-if="title == '业务详情'">
			  <van-field v-model="siteName1" type='textarea'  autosize rows="1" disabled label="业务名称" input-align="right"/>
			  <van-field v-model="siteName" disabled label="起始站点" input-align="right"/>
			  <van-field v-model="siteName" disabled label="终点站点" input-align="right"/>
			  <van-field v-model="siteName" disabled label="传输路由" input-align="right"/>
			  <van-field v-model="siteName" disabled label="业务类型" input-align="right"/>
			  <van-field v-model="siteName" disabled label="调度等级" input-align="right"/>
			  <van-field v-model="siteName" disabled label="方式票号" input-align="right"/>
			  <van-field v-model="siteName" disabled label="业务宽度" input-align="right"/>
			</van-form>
			
			<!-- 纤芯详情 -->
			<van-form v-if="title == '纤芯详情'">
			  <van-field v-model="params.opticalname||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="所属光缆名称" input-align="right" label-width="118px"/>
			    <van-field v-model="params.asiteName||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="起始站点" input-align="right"/>
			  <van-field v-model="params.zsiteName||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="终止站点" input-align="right"/>
			  <van-field v-model="params.isOccupy||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="纤芯状态" input-align="right"/>
			  <van-field v-model="params.length||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="测试长度" input-align="right"/>
			  <van-field v-model="params.loss||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="全程总损耗" input-align="right"/>
			  <van-field v-model="params.isSmoothness||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="曲线是否平滑" input-align="right" label-width="118px"/>
			  <van-field v-model="params.breakpoint||'--'" :colon="true" type='textarea' rows="1" autosize disabled label="断点位置" input-align="right"/>
			</van-form>
		</view>
	</view>
</template>

<script>
	import navBar from "../../../../components/common/nav-bar.vue";
	import {
		getFiberCoreOverall
	} from "../../../../api/ydtzApi.js"
	export default {
		data() {
			return {
				siteName:'AAAAAA变电站',
				siteName1:'(榆社开闭站)-(洪善变)继电保护业务',
				title:'',
				params:{}
			}
		},
		components: {
			navBar,
		},
		onLoad(option){
			this.title = option.title
			this.getFiberCoreOverall(option)
		},
		methods: {
			goBack() {
				uni.navigateBack()
			},
			// 获取详情
			getFiberCoreOverall(option) {
				this.$apiRequest.ydtzApi.getFiberCoreOverall({
					objId: option.objId,
				}).then(({
					data: res
				}) => {
					this.params = res
					if(res.length){
						this.params.length = res.length+'KM'
					}
					if(res.loss){
						this.params.loss = res.loss+'dB'
					}
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #f2f6fa;;
	}
	.header {
		position: sticky;
		top: 0;
		z-index: 999;
	}
	.bussiness-detail {
	  width: calc(100vw - #{px2vw(60)});
	  background: #fff;
	  border-radius: px2vw(20);
	  margin:px2vh(30) auto;
	  ::v-deep .van-field__control:disabled {
	  	-webkit-text-fill-color: #333;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
	  }
	}
</style>